<?php
class Menu {

	public function __toString(){
            global $cnxIntra;
            $queryIntra = new Consulta($cnxIntra, "SELECT * FROM modulo order by ordem");
            $html ="\t<ul>";
            foreach($queryIntra->getResultados()as $linha){
                //$classeCss = "middle";
                $label = $linha['label'];
                $exibirMenu = $linha['exibirMenu'];
                $nome =$linha["nome"];
                $descricao = $linha['descricao'];
                if($exibirMenu == 0){
                    $url ="?app=$nome";
                    if($nome=="Setor"){
                        $url ="?app=Assunto";
                    }
                    if($label != null){
                        $html .= "\t\t<li>\n" .
                                 "\t\t\t<a href=\"$url\">$label</a>\n" .
                                 "\t\t</li>";
                    }
                    else{
                        $html .= "\t\t<li>\n" .
                                 "\t\t\t<a href=\"$url\">$nome</a> \n" .
                                 "\t\t</li>";
                    }
                }
			
	}
        $bottom= "\t\t<li class=\"bottom\">\n" .
                 "\t\t\t<a href=\"logoff.php\">Sair</a> \n" .
                 "\t\t</li>";
        return  $html . $bottom . "\t</ul>";
	}
}
?>